using System.Collections.Generic;

using Tao.OpenGl;

namespace OhioState.Graphics.OpenGL
{
    public class LayerGL : IDrawable
    {
        #region Public Properties
        public float Depth
        {
            get;
            set;
        }
        #endregion

        #region Constructors
        public LayerGL()
        {
            Depth = 0.0f;
        }
        #endregion

        #region IDrawable
        public IMaterial Material
        {
            get;
            set;
        }

        public void Render(IRenderPanel panel)
        {
            // Composite the billboards.
            if (Material != null)
                Material.MakeActive(panel);

            Gl.glBegin(Gl.GL_QUADS);
            Gl.glTexCoord2f(0.0f, 0.0f);
            Gl.glVertex3f(0.0f, 0.0f, Depth);
            Gl.glTexCoord2f(1.0f, 0.0f);
            Gl.glVertex3f(1.0f, 0.0f, Depth);
            Gl.glTexCoord2f(1.0f, 1.0f);
            Gl.glVertex3f(1.0f, 1.0f, Depth);
            Gl.glTexCoord2f(0.0f, 1.0f);
            Gl.glVertex3f(0.0f, 1.0f, Depth);
            Gl.glEnd();
            if (Material != null)
                Material.Deactivate(panel);
        }

        public IBoundingVolume BoundingVolume
        {
            get { throw new System.NotImplementedException(); }
        }
        #endregion
    }
}
